<div class="action-block is-rounded" data-test-demote-replication>
  <div class="action-block-info">
    <h4 class="title is-5 is-marginless">
      Demote cluster
    </h4>
    <p>
      Demote this {{model.replicationModeForDisplay}} primary to a secondary.
    </p>
  </div>
  <div class="action-block-action">
    <button
      type="button"
      class="button is-secondary"
      onclick={{action (mut isModalActive) true}}
      data-test-replication-action-trigger
    >
      Demote
    </button>
  </div>
</div>

<ConfirmationModal
  @title="Demote to secondary?"
  @onClose={{action (mut isModalActive) false}}
  @isActive={{isModalActive}}
  @buttonClass="is-primary"
  @confirmText={{model.replicationModeForDisplay}}
  @toConfirmMsg="demoting this cluster"
  @onConfirm={{action "onSubmit" "demote" model.replicationAttrs.modeForUrl}}
  @testSelector="demote"
>
  <p class="has-bottom-margin-m">
    {{#if (and
      (eq replicationMode 'dr')
      (not model.performance.replicationDisabled)
    )}}
      <p class="has-bottom-margin-m" data-test-demote-warning>
        This cluster is currently operating as a performance secondary. Demoting it will leave your replication setup <strong>without a performance primary cluster</strong> until a new cluster is promoted.
      </p>
    {{/if}}
    Demoting this {{model.replicationModeForDisplay}} primary to a {{model.replicationModeForDisplay}} secondary means that the resulting secondary cluster:
  </p>
  <ul class="bullet has-bottom-margin-m">
    {{#if (and
      (eq replicationMode 'dr')
      (not model.performance.replicationDisabled)
    )}}
      <li>Will be read-only</li>
    {{/if}}
    <li>Will not attempt to connect to a primary</li>
    <li>Will maintain knowledge of its cluster ID</li>
    <li>Can be reconnected to the same set of replication clusters without wiping local storage.</li>
  </ul>
  <p class="has-bottom-margin-m">
    To connect the resulting secondary to a new primary, use the Update primary action.
  </p>
</ConfirmationModal>
